package cn.touna.jss.common.dict.service.impl;

import cn.touna.jss.common.dict.service.DictService;
import cn.touna.jss.common.dict.entity.SysDict;
import cn.touna.jss.modules.credit.mapper.SysDictMapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 数据字典
 * 
 */
@Service
public class DictServiceImpl  implements DictService {
    /** 日志常量类 */
    private static final Log LOG = LogFactory.getLog(DictServiceImpl.class);

    /** 引入数据字典Mapper */
    @Autowired
    private SysDictMapper dictMapper;


    /**
     * 根据数据字典类型获取数据字典列表
     * 
     * @param  dataType
     * @param  dataCode
     * @return 返回同一类型的数据字典集合
     */
    @Cacheable(value="dictCache",key="#dataType")
    @Override
    public List<SysDict> queryListByDataType(String dataType,String dataCode) {
        Map<String, String> map = new HashMap<String, String>();
        map.put("dataType", dataType);
        map.put("dataCode", dataCode);
        return dictMapper.queryListByDataType(map);
    }
}
